<?php
    $now = R::isoDateTime();

    $a = R::dispense( 'gactivity');
    $a->user = $user;
    $a->group = $group;
    $a->dateFrom = $now;
    $a->dateTo = $now;
    $a = R::store( $a );

    $group->sharedUserList[] = R::load('user', $u_id); //add to activated
    $group->nonActiveUsers = activateUserGroup($u_id, $group); //remove from non_active
    //$group->developers = addDeveloperGroup($u_id, $group); //add to developer
    $g = R::store($group);

    if(isset($a) && isset($g)){
        $result["success"] = 'true';
        $result["message"] = 'Successfully activated user';
        echo json_encode($result);
        die();
    }